#pragma once
#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string>

class InetAddr
{
    public:
    InetAddr(struct sockaddr_in &addr)
    {
        port = ntohs(addr.sin_port);
        ip = inet_ntoa(addr.sin_addr);

        std::string clientinfo = ip;
        clientinfo += ":";
        clientinfo += std::to_string(port);
            /* data */
    };
    std::string IP() {return ip;}
    uint16_t Port() {return port;}
    std::string PrintDebug()
    {
        std::string clientinfo = ip;
        clientinfo += ":";
        clientinfo += std::to_string(port);

        return clientinfo;
    }
    ~InetAddr()
    {}
private:
    std::string ip;
    uint16_t port;
};